<%@ page import="connect.InfoDao" %>
<%@ page import="java.util.List" %>
<%@ page import="model.Info" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Org 2</title>
</head>
<body>
<jsp:include page="top2.jsp"/>
<%
    //先获取or2的交易单号列表
    InfoDao infodao =  new InfoDao();
    List<Integer> tradelist = infodao.getTradeByOrgAndStatus(2,0);
%>
<!-- service section -->
<section class="service_section layout_padding">
    <div class="container">
        <div class="heading_container">
            <h2>
                物流公司b中转站货物信息
            </h2>
        </div>

        <div class="contact-form" style="text-align: center;">
            <form action="org2Do.jsp" name="nameForm" >
                <input type="text" name="name" id="name" placeholder="输入订单号来查询物流订单详情" style="border: none;
  outline: none;
  background-color: transparent;
  width: 30%;
  margin: 15px 0;
  padding: 10px 20px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 30px;">
                <button type="submit" class="btn_on-hover" onclick="return checkName2()" style="border: none;
  outline: none;
  display: inline-block;
  padding: 10px 25px;
  background-color: #582fd7;
  color: #ffffff;
  border-radius: 5px;
  text-transform: uppercase;
  margin-top: 15px;">
                    查询
                </button>
            </form>
        </div>

        <script type="text/javascript">
            function checkName2() {
                var name = nameForm.name.value;
                if (name == "" || name == null) {
                    alert("请输入订单号");//弹出提示
                    nameForm.name.focus();//把鼠标焦点移到name里
                    return false;
                }
                return true;
            }
        </script>

        <div class="service_container">
            <%
                for (int i = 0; i < tradelist.size(); i++) {
                    int trade=tradelist.get(i);
            %>
            <div class="box">
                <div class="detail-box">
                    <table align="center" cellspacing="0">
                        <tr  style="font-size: 20px;height:60px;text-align: center">
                            <td style="width:100px">订单号</td>
                            <td style="width: 100px">用户名</td>
                            <td style="width: 100px">价格</td>

                        </tr>
                        <%
                            List<Info> infoList = infodao.getInfoByTradeAndOrg(trade,2,0);
                            for (int j=0;j<infoList.size();j++){
                                Info in=infoList.get(j);
                        %>
                        <tr style="height:40px;text-align: center">
                            <td><%=in.getId()%>
                            </td>
                            <td><%=in.getName()%>
                            </td>
                            <td><%=in.getPrice()%>
                            </td>

                        </tr>
                        <%
                            }
                        %>
                        <tr style="height:30px;text-align: center"></tr>
                    </table>

                    <div class="btn-box">
                        <a href="orgDo.jsp?org=2&trade=<%=trade%>">
                            确认货物已送达
                        </a>
                    </div>
                </div>
            </div>
            <%
                }
            %>

        </div>
    </div>
</section>
<!-- end service section -->
<jsp:include page="footer.jsp"/>

</body>
</html>
